package ch.kerbtier.malurus.updaters;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ch.kerbtier.malurus.RequestContext;

public abstract class JavaComponentUpdater<T> {
	private T subject;
	private RequestContext context;

	public HttpServletRequest getRequest() {
		return context.getRequest();
	}

	public HttpServletResponse getResponse() {
		return context.getResponse();
	}

	public T getSubject() {
		return subject;
	}

	public PrintWriter getWriter() {
		return context.getWriter();
	}

	public abstract void update();

	protected void setSubject(T subject) {
		this.subject = subject;
	}

	protected void setContext(RequestContext context) {
		this.context = context;
	}

	public String getAction() {
		return context.getRequest().getParameter("buiAction");
	}
}
